<%@ page import="java.util.Date" %><%--
  Created by IntelliJ IDEA.
  User: 李雨昂
  Date: 2019/9/16
  Time: 14:16
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>ajax</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
</head>
<style>



</style>
<body onload="initData()">
    <%= new Date()%>

    <div id="outer">
        <table>
            <thead>
                <th>id</th>
                <th>手机名称</th>
                <th>价格</th>
                <th>操作</th>
            </thead>
            <tbody id="content">

            </tbody>

        </table>

    </div>


    <script>

        function initData(){
            var xmlHttp = new XMLHttpRequest();
            xmlHttp.onreadystatechange = function () {
                if(xmlHttp.readyState == 4 && xmlHttp.status == 200){
                    //js操作dom
                    //json的数组
                var arr = [{"id":2,"name":"小米","price":123.45},{"id":2,"name":"小米","price":123.45}];
                }

            }
        }
    </script>
</body>
</html>
